package assql
{
	import flash.net.URLRequest;
	import flash.utils.ByteArray;
	
	/**
	 * Used to access the results returned by a SQL query.
	 **/
	public interface ResultSet
	{
		/**
		 * Moves the cursor just after the last row
		 **/
		function afterLast():void;
		
		/**
		 * Moves the cursor just before the first row
		 **/
		function beforeFirst():void;
		
		/**
		 * Finds the index of the specified column name in this ResultSet
		 **/
		function findColumn(name:String):int;
		
		/**
		 * Moves the cursor to the first row
		 * 
		 * @return true if the cursor is on a valid row, false if there are no rows in this ResultSet
		 **/
		function first():Boolean;
		
		/**
		 * Retrives the value of the specified column as a ByteArray
		 **/
		function getByteArray(column:*):ByteArray;
		
		/**
		 * Retrives the value of the specified column as a Blob
		 **/
		function getBlob(column:*):Blob;
		
		/**
		 * Retrives the value of the specified column as a Boolean
		 **/
		function getBoolean(column:*):Boolean;
		
		/**
		 * Retrives the value of the specified column as a Clob
		 **/
		function getClob(column:*):Clob;
		
		/**
		 * Retrives the value of the specified column as a Date
		 **/
		function getDate(column:*):SQLDate;
		
		/**
		 * Retrives the value of the specified column as Integer
		 **/
		function getInt(column:*):int;
		
		/**
		 * Gets the metadata for this ResultSet
		 **/
		function getMetaData():ResultSetMetaData;
		
		/**
		 * Retrives the value of the specified column as a Number
		 **/
		function getNumber(column:*):Number;
		
		/**
		 * Retrives the value of the specified column as a String
		 **/
		function getString(column:*):String;
		
		/**
		 * Retrives the value of the specified column as Time
		 * 
		 * @see assql.Time Time
		 **/
		function getTime(column:*):SQLTime;
		
		/**
		 * Retrives the value of the specified column as a Timestamp
		 * 
		 * @see assel.Timestamp Timestamp
		 **/
		function getTimestamp(column:*):SQLTimestamp;
		
		/**
		 * Retrives the value of the specified column as a URLRequest
		 **/
		function getUrl(column:*):URLRequest;
		
		/**
		 * Returns true if the cursor is after the last row.
		 **/
		function isAfterLast():Boolean;
		
		/**
		 * Returns true if the cursor is before the first row.
		 **/
		function isBeforeFirst():Boolean;
		
		/**
		 * Returns true if the cursor is on the first row
		 **/
		function isFirst():Boolean;
		
		/**
		 * Returns true if the cursor is on the last row.
		 **/
		function isLast():Boolean;
		
		/**
		 * Moves the cursor to the last row in this ResultSet
		 * 
		 * @returns false if there is no rows in the ResultSet, true otherwise
		 **/
		function last():Boolean;
		
		/**
		 * Move the cursor to the next row.
		 * 
		 * @return false if there is no more rows after the current cursor position, true otherwise
		 **/
		function next():Boolean;
		
		/**
		 * Moves the cursor to the previous row
		 * 
		 * @return false if there is no rows before the current cursor position, true otherwise
		 **/
		function previous():Boolean;
		
		/**
		 * Moves the cursor the specified number of rows, relative to it's current position
		 * 
		 * @param rows the number of rows to move
		 * @return true if the cursor is on a row, false otherwise
		 **/
		function relative(rows:int):Boolean;
		
		/**
		 * Returns the number of rows in this ResultSet
		 **/
		function size():Number;
		
		/**
		 * Release this ResultSet from memory
		 **/
		function dispose():void; 
	}
}